package com.shqcjd.sinopecdemomobile.ui.activity.problem;

import android.content.Context;
import android.support.design.widget.TabLayout;
import android.widget.ImageView;
import android.widget.TextView;

import com.shqcjd.sinopecdemomobile.R;
import com.shqcjd.sinopecdemomobile.ui.adapter.TabLayoutViewPagerAdapter;
import com.shqcjd.sinopecdemomobile.ui.base.BaseActivity;
import com.shqcjd.sinopecdemomobile.ui.base.BasePresenter;
import com.shqcjd.sinopecdemomobile.ui.fragment.problem.MyProblemFragment;
import com.shqcjd.sinopecdemomobile.ui.fragment.problem.OfflineProblemFragment;
import com.shqcjd.sinopecdemomobile.widget.CustomScrollViewPager;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 我的问题——全部问题
 */
public class AllProblemListActivity extends BaseActivity {


    @BindView(R.id.iv_toolbar_back)
    ImageView ivToolbarBack;
    @BindView(R.id.tv_toolbar_center)
    TextView tvToolbarCenter;
    @BindView(R.id.tab_mine_layout)
    TabLayout tabMineLayout;
    @BindView(R.id.viewpager_mine)
    CustomScrollViewPager viewpagerMine;
    private Context mContext;

    @Override
    protected BasePresenter createPresenter() {
        return null;
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_all_problem_list;
    }

    @Override
    public void initView() {
        mContext = this;
        tvToolbarCenter.setText("全部问题");

        TabLayoutViewPagerAdapter adapter = new TabLayoutViewPagerAdapter(getSupportFragmentManager());
        adapter.addFragment(OfflineProblemFragment.newInstance(), "离线");
        adapter.addFragment(MyProblemFragment.newInstance("0"), "待回答");
        adapter.addFragment(MyProblemFragment.newInstance("1"), "已回答");
        adapter.addFragment(MyProblemFragment.newInstance(""), "全部问题");
        viewpagerMine.setAdapter(adapter);
        tabMineLayout.setupWithViewPager(viewpagerMine);
        viewpagerMine.setScrollable(false);

    }

    @OnClick(R.id.iv_toolbar_back)
    public void onViewClicked() {
        finish();
    }
}
